from setuptools import setup

from Cython.Build import cythonize

# Cython 编译参数
COMPILER_DIRECTIVES = {
    'language_level': 3,
    'always_allow_keywords': True,
    'annotation_typing': False
}


class Operator:

    def compile(self):
        names = ['demo/application.py']

        # 执行
        setup(
            ext_modules=cythonize(names, quiet=True, compiler_directives=COMPILER_DIRECTIVES),
            script_args=['build_ext', '--inplace']
        )

    def execute(self):
        self.compile()


Operator().execute()